home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Sound / GSMToast / man / gsm.3.txt < prev    next >
Encoding:
Text File  |  1996-04-28  |  3.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GSM(3)                 C Library Functions                 GSM(3)
  5.  
  6.  
  7.  
  8. NAME
  9.      gsm_create, gsm_destroy, gsm_encode, gsm_decode -  GSM 06.10
  10.      lossy sound compression
  11.  
  12. SYNOPSIS
  13.      #include "gsm.h"
  14.  
  15.      gsm gsm_create();
  16.  
  17.      void gsm_encode(handle, src, dst)
  18.      gsm handle;
  19.      gsm_signal src[160];
  20.      gsm_frame dst;
  21.  
  22.      int gsm_decode(handle, src, dst)
  23.      gsm handle;
  24.      gsm_frame src;
  25.      gsm_signal dst[160];
  26.  
  27.      void gsm_destroy(handle)
  28.      gsm handle;
  29.  
  30. DESCRIPTION
  31.      Gsm is an implementation of the final draft GSM 06.10  stan-
  32.      dard for full-rate speech transcoding.
  33.  
  34.      gsm_create() initializes a gsm  pass  and  returns  a  'gsm'
  35.      object  which can be used as a handle in subsequent calls to
  36.      gsm_decode(), gsm_encode() or gsm_destroy().
  37.  
  38.      gsm_encode() encodes an array of 160 13-bit  samples  (given
  39.      as gsm_signal's, signed integral values of at least 16 bits)
  40.      into a gsm_frame of 33 bytes.  (gsm_frame is a type  defined
  41.      as an array of 33 gsm_bytes in gsm.h.)
  42.  
  43.      gsm_decode() decodes a gsm_frame into an array of 160 13-bit
  44.      samples (given as gsm_signals), which sound rather like what
  45.      you handed to gsm_encode() on the other side of the wire.
  46.  
  47.      gsm_destroy() finishes a gsm  pass  and  frees  all  storage
  48.      associated with it.
  49.  
  50.   Sample format
  51.      The following scaling is assumed for input to the algorithm:
  52.         0  1                             11 12
  53.         S..v..v..v..v..v..v..v..v..v..v..v..v..*..*..*
  54.      Only the top 13 bits are used as a signed input value.
  55.      The output of gsm_decode() has the three lower bits set to zero.
  56.  
  57. RETURN VALUE
  58.      gsm_create() returns an opaque handle object of type gsm, or
  59.      0  on error.  gsm_decode() returns -1 if the passed frame is
  60.  
  61.  
  62.  
  63. SunOS 5.4                 Last change:                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GSM(3)                 C Library Functions                 GSM(3)
  71.  
  72.  
  73.  
  74.      invalid, else 0.
  75.  
  76. EXAMPLE
  77.      #include "gsm.h"
  78.  
  79.      gsm handle;
  80.      gsm_frame buf;
  81.      gsm_signal sample[160];
  82.      int cc, soundfd;
  83.  
  84.      play() {  /* read compressed data from standard input, write to soundfd */
  85.  
  86.           if (!(handle = gsm_create())) error...
  87.           while (cc = read(0, (char *)buf, sizeof buf)) {
  88.                if (cc != sizeof buf) error...
  89.                if (gsm_decode(handle, buf, sample) < 0) error...
  90.                if (write(soundfd, sample, sizeof sample) != sizeof sample)
  91.                     error...
  92.           }
  93.           gsm_destroy(handle);
  94.      }
  95.  
  96.      record() {     /* read from soundfd, write compressed to standard output */
  97.  
  98.           if (!(handle = gsm_create())) error...
  99.           while (cc = read(soundfd, sample, sizeof sample)) {
  100.                if (cc != sizeof sample) error...
  101.                gsm_encode(handle, sample, buf);
  102.                if (write(1, (char *)buf, sizeof buf) != sizeof sample)
  103.                     error...
  104.           }
  105.           gsm_destroy(handle);
  106.      }
  107.  
  108. BUGS
  109.      Please  direct  bug  reports  to  jutta@cs.tu-berlin.de  and
  110.      cabo@cs.tu-berlin.de.
  111.  
  112. SEE ALSO
  113.      toast(1), gsm_print(3), gsm_explode(3), gsm_option(3)
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. SunOS 5.4                 Last change:                          2
  130.  
  131.  
  132.  
  133.